home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / misc / volume21 / wacco / patch02 next >
Encoding:
Text File  |  1991-07-26  |  4.8 KB  |  144 lines

  1. Newsgroups: comp.sources.misc
  2. From: Parag Patel <parag@hpsdeb.sde.hp.com>
  3. Subject:  v21i044:  wacco - A C++ LL parser generator, Patch02
  4. Message-ID: <1991Jul26.213550.2871@sparky.IMD.Sterling.COM>
  5. X-Md4-Signature: 93d66e775d87fd9a19614e1a74ba695c
  6. Date: Fri, 26 Jul 1991 21:35:50 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: Parag Patel <parag@hpsdeb.sde.hp.com>
  10. Posting-number: Volume 21, Issue 44
  11. Archive-name: wacco/patch02
  12. Patch-To: wacco: Volume 19, Issue 88-93
  13. Environment: C++, UNIX
  14.  
  15. This is a small patch to convert wacco 1.2 to 1.3.  There is a nasty bug
  16. which dumps core when code fragments within {} curlies are bigger than
  17. 1024 bytes.  Oops.  "Sorry about that, chief!"  This patch kills the bug.
  18.  
  19. Wacco is basically an LL(1) parser generator.  Wacco generates 
  20. recursive-descent C++ code from an input file.  The wacco file.w 
  21. looks a lot like a yacc(1) input file, but with a lot more syntactic 
  22. sugar added.  Since the parser generated recurses, you can do 
  23. attribute-driven parsing easily and even pass information into rules
  24. which could alter the parse.
  25.  
  26. Wacco should port and run easily on most C++ systems.  It does need C++
  27. 2.0 of some flavor.  It's been successfully built on HP-UX s300 and s800
  28. systems, Sparc, and 4.3BSD running on HP hardware.  
  29.  
  30. The code is somewhat commented.  Feel free to hack away, add new
  31. features, or fix my screwups.  If you make mods you feel are useful, or
  32. fix some bug, please send me the cdiffs so I can make them available to
  33. others too.
  34.  
  35. Parag Patel <parag@hpsdeb.sde.hp.com>
  36.  
  37.     -- Parag
  38.  
  39. ---- Cut Here and feed the following to sh ----
  40. #!/bin/sh
  41. # This is a shell archive (produced by shar 3.49)
  42. # To extract the files from this archive, save it to a file, remove
  43. # everything above the "!/bin/sh" line above, and type "sh file_name".
  44. #
  45. # made 07/25/1991 18:11 UTC by parag@tin
  46. # Source directory /parag/tools/wacco
  47. #
  48. # existing files will NOT be overwritten unless -c is specified
  49. #
  50. # This shar contains:
  51. # length  mode       name
  52. # ------ ---------- ------------------------------------------
  53. #   2365 -rw-r--r-- patch-1.2-1.3
  54. #
  55. # ============= patch-1.2-1.3 ==============
  56. if test -f 'patch-1.2-1.3' -a X"$1" != X"-c"; then
  57.     echo 'x - skipping patch-1.2-1.3 (File already exists)'
  58. else
  59. sed 's/^X//' << 'SHAR_EOF' > 'patch-1.2-1.3' &&
  60. *** tmp/README    Mon May 20 19:38:39 1991
  61. --- README    Tue Jul 23 17:49:50 1991
  62. ***************
  63. *** 1,4
  64. ! $Header: README,v 1.10 91/05/20 20:38:40 hmgr Exp $
  65. X  
  66. X  Copyright (c) 1991 by Parag Patel.  All Rights Reserved.
  67. X  You can do what you wish with this as long as
  68. X
  69. --- 1,4 -----
  70. ! $Header: README,v 1.11 91/07/23 18:49:49 hmgr Exp $
  71. X  
  72. X  Copyright (c) 1991 by Parag Patel.  All Rights Reserved.
  73. X  You can do what you wish with this as long as
  74. ***************
  75. *** 75,77
  76. X      bug in gen.C fixed where the string "(null)" was generated on Sparc
  77. X          because I was passing NULL to printf()
  78. X      some typos fixed in wacco.doc example but NOT in wacco.doc.{iw,ps}
  79. X
  80. --- 75,79 -----
  81. X      bug in gen.C fixed where the string "(null)" was generated on Sparc
  82. X          because I was passing NULL to printf()
  83. X      some typos fixed in wacco.doc example but NOT in wacco.doc.{iw,ps}
  84. + 1.3    fixed bug in gen.C which wouldn't dump user code bigger than 1024 bytes
  85. *** tmp/gen.C    Tue Jul 23 17:46:15 1991
  86. --- gen.C    Tue Jul 23 17:49:58 1991
  87. ***************
  88. *** 1,5
  89. X  // Copyright (c) 1991 by Parag Patel.  All Rights Reserved.
  90. ! static const char rcs_id[] = "$Header: gen.C,v 1.30 91/05/20 13:18:31 hmgr Exp $";
  91. X  
  92. X  #include "defs.h"
  93. X  #include "toks.h"
  94. X
  95. --- 1,5 -----
  96. X  // Copyright (c) 1991 by Parag Patel.  All Rights Reserved.
  97. ! static const char rcs_id[] = "$Header: gen.C,v 1.31 91/07/23 18:49:55 hmgr Exp $";
  98. X  
  99. X  #include "defs.h"
  100. X  #include "toks.h"
  101. ***************
  102. *** 172,178
  103. X          putf("#line %d \"%s\"\n", code->line, inputfile);
  104. X      else
  105. X          putf("/* #line %d */\n", code->line);
  106. !     putf("%s%s;\n", pre, code->code);
  107. X      if (genlineinfo)
  108. X          putf("#line %d \"%s\"\n", curr_lineno + 1, currfile);
  109. X  }
  110. X
  111. --- 172,180 -----
  112. X          putf("#line %d \"%s\"\n", code->line, inputfile);
  113. X      else
  114. X          putf("/* #line %d */\n", code->line);
  115. !     putf("%s", pre);
  116. !     fputs(code->code, fp);    // if this is bigger than 1024, putf() fails
  117. !     putf(";\n");
  118. X      if (genlineinfo)
  119. X          putf("#line %d \"%s\"\n", curr_lineno + 1, currfile);
  120. X  }
  121. *** tmp/version.C    Mon May 20 12:18:33 1991
  122. --- version.C    Tue Jul 23 17:49:52 1991
  123. ***************
  124. *** 1,3
  125. X  // Copyright (c) 1991 by Parag Patel.  All Rights Reserved.
  126. X  
  127. ! static char *const whatid = "@(#)wacco 1.2 (20 May 1991)";
  128. X
  129. --- 1,3 -----
  130. X  // Copyright (c) 1991 by Parag Patel.  All Rights Reserved.
  131. X  
  132. ! static char *const whatid = "@(#)wacco 1.3 (23 July 1991)";
  133. SHAR_EOF
  134. chmod 0644 patch-1.2-1.3 ||
  135. echo 'restore of patch-1.2-1.3 failed'
  136. Wc_c="`wc -c < 'patch-1.2-1.3'`"
  137. test 2365 -eq "$Wc_c" ||
  138.     echo 'patch-1.2-1.3: original size 2365, current size' "$Wc_c"
  139. fi
  140. exit 0
  141.  
  142. exit 0 # Just in case...
  143.